package ntd.action.bo;

import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author: liuwenju
 * @date: 2023/6/12 17:17
 * @version: 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ActionOutBo {

    private Object data;

    public <T> T t() {
        return (T) data;
    }

    public byte[] toBytes() {
        if (data instanceof byte[]) {
            return t();
        }
        return StrUtil.bytes(JSONUtil.toJsonStr(data));
    }

    public String s() {
        return String.valueOf(data);
    }

}
